-
Notifications
You must be signed in to change notification settings - Fork 218
Enhance navigation with smooth scroll to specific elements #10349
Conversation
This commit introduces changes to the directive.js and ProductQuery.php files. In directives.js, the functionality of fetching a page and updating scroll behavior is enhanced. Now, apart from the smooth or default scroll, the function also considers the 'scrollToSelector' property of a link. It calculates the top position of the element (identified by the selector) in the viewport and uses it for scrolling, providing a more precise and user-friendly scrolling experience. In ProductQuery.php, the navigation link payload is updated to include a 'scrollToSelector' attribute. This attribute uses a data attribute selector that identifies the product block that the navigation link should scroll to. These enhancements improve user navigation by allowing smooth scrolling to specific product blocks rather than just the top of the page.
The release ZIP for this PR is accessible via:
TypeScript Errors Report
assets/js/blocks/mini-cart/edit.tsx
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the |
Size Change: +51 B (0%) Total Size: 1.36 MB
ℹ️ View Unchanged
|
Hey Manish, what do you think about modifying The logic would be something along these lines: if the Let's see how it goes! |
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
I'm going to close this PR for now since it's not of high priority. I'll reopen it or create a new PR when we start working on it again. |
In directives.js, the functionality of fetching a page and updating scroll behavior is enhanced. Now, apart from the smooth or default scroll, the function also considers the 'scrollToSelector' property of a link. It calculates the top position of the element (identified by the selector) in the viewport and uses it for scrolling, providing a more precise and user-friendly scrolling experience.
In ProductQuery.php, the navigation link payload is updated to include a 'scrollToSelector' attribute. This attribute uses a data attribute selector that identifies the product block that the navigation link should scroll to.
These enhancements improve user navigation by allowing smooth scrolling to specific product blocks rather than just the top of the page.
Fixes #
Accessibility
prefers-reduced-motion
Other Checks
Screenshots
Testing
Automated Tests
User Facing Testing
WooCommerce Visibility
Performance Impact
Changelog